package com.crm.business.crm.service.impl;

import com.crm.business.crm.mapper.HpCrmLeadsSetUpMapper;
import com.crm.business.crm.service.HpCrmLeadsSetUpService;
import com.crm.common.crm.entity.BO.HpCrmSetupLeadsNumBO;
import com.crm.common.crm.entity.VO.HpCrmSetupLeadsNumVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
@Slf4j
public class HpCrmLeadsSetUpServiceImpl  implements HpCrmLeadsSetUpService {


    @Autowired
    private HpCrmLeadsSetUpMapper hpCrmLeadsSetUpMapper;
    @Override
    public HpCrmSetupLeadsNumVO selectHpCrmSetupLeadsNumByownerUserId(Integer ownerUserId) {
        return hpCrmLeadsSetUpMapper.selectHpCrmSetupLeadsNumByownerUserId(ownerUserId);
    }


    /**
     * 查询线索分配设置
     *
     * @param id 线索分配设置ID
     * @return 线索分配设置
     */
    @Override
    public HpCrmSetupLeadsNumVO selectHpCrmSetupLeadsNumById(Long id) {
        return hpCrmLeadsSetUpMapper.selectHpCrmSetupLeadsNumById(id);
    }

    /**
     * 新增线索分配设置
     *
     * @param hpCrmSetupLeadsNum 线索分配设置
     * @return 结果
     */
    @Override
    public int insertHpCrmSetupLeadsNum(HpCrmSetupLeadsNumBO hpCrmSetupLeadsNum){
        hpCrmSetupLeadsNum.setCreateTime(new Date());
        hpCrmSetupLeadsNum.setUpdateTime(new Date());
        return hpCrmLeadsSetUpMapper.insertHpCrmSetupLeadsNum(hpCrmSetupLeadsNum);
    }

    /**
     * 修改线索分配设置
     *
     * @param hpCrmSetupLeadsNum 线索分配设置
     * @return 结果
     */
    @Override
    public int updateHpCrmSetupLeadsNum(HpCrmSetupLeadsNumBO hpCrmSetupLeadsNum){
        hpCrmSetupLeadsNum.setUpdateTime(new Date());
        return hpCrmLeadsSetUpMapper.updateHpCrmSetupLeadsNum(hpCrmSetupLeadsNum);
    }

    /**
     * 删除线索分配设置
     *
     * @param id 线索分配设置ID
     * @return 结果
     */
    @Override
    public int deleteHpCrmSetupLeadsNumById(Long id){
        return hpCrmLeadsSetUpMapper.deleteHpCrmSetupLeadsNumById(id);
    }

    /**
     * 批量删除线索分配设置
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHpCrmSetupLeadsNumByIds(String[] ids){
        return hpCrmLeadsSetUpMapper.deleteHpCrmSetupLeadsNumByIds(ids);
    }

}
